<form id="withdraw-requeest-form" class="form-horizontal" action="{{ route('commissions.pay_to_seller') }}" method="POST">
    @csrf
    <div class="modal-header">
        <h5 class="modal-title h6">{{translate('Pay to seller')}}</h5>
        <button type="button" class="close" data-dismiss="modal">
        </button>
    </div>
    <div class="modal-body">
        <table class="table table-striped table-bordered">
            <tbody>
            <tr>

                <td>{{ translate('Due to seller') }}</td>
            <!--<td>{{ single_price($seller->can_to_pay) }}</td>-->
                <td>{{ single_price($seller_withdraw_request->amount) }}</td>

            </tr>
            <!--<tr>
                        <td>{{ translate('Requested Amount is ') }}</td>
                        <td>{{ single_price($seller_withdraw_request->amount) }}</td>
                </tr>-->


            <tr>
                <td>{{ translate('Payment Cash Only') }}</td>
                <td>{{ translate($seller->cash_on_delivery_status ? 'Yes' : 'No')  }}</td>
            </tr>
            <tr>
                <td>{{ translate('Payment Bank Only') }}</td>
                <td>{{ translate($seller->bank_payment_status ? 'Yes' : 'No')  }}</td>
            </tr>

            @if($seller->bank_payment_status == 1)
                <!-- <tr>
                        <td>{{ translate('Bank Name') }}</td>
                        <td>{{ $seller->bank_name }}</td>
                    </tr>
                    <tr>
                        <td>{{ translate('Bank Account Name') }}</td>
                        <td>{{ $seller->bank_acc_name }}</td>
                    </tr>
                    <tr>
                        <td>{{ translate('Bank Account Number') }}</td>
                        <td>{{ $seller->bank_acc_no }}</td>
                    </tr>
                    <tr>
                        <td>{{ translate('Bank Routing Number') }}</td>
                        <td>{{ $seller->bank_routing_no }}</td>
                    </tr>-->
                <tr>
                    <td>{{ translate('Bank Name') }}</td>
                    <td>{{ $seller->bank_acc_name }}</td>
                </tr>
                <tr>
                    <td>{{ translate('Bank Account Name') }}</td>
                    <td>{{ $seller-> bank_acc_no }}</td>
                </tr>
                <tr>
                    <td>{{ translate('Bank Account Number') }}</td>
                    <td>{{ $seller->bank_routing_no }}</td>
                </tr>
                <tr>
                    <td>{{ translate('Bank Routing Number') }}</td>
                    <td>{{ $seller->bank_name }}</td>
                </tr>
            @endif

            </tbody>
        </table>

        <input type="hidden" name="withdraw_request_id" value="{{ $seller_withdraw_request->id }}">
        <div class="form-group row">
            <label class="col-sm-3 col-from-label" for="amount">{{translate('Requested Amount')}}</label>
            <div class="col-sm-9">

            <!--<input type="number" lang="en" min="0" step="0.01" name="amount" id="amount" value="{{ $seller_withdraw_request->amount }}" class="form-control" required>-->
                {{ single_price($seller_withdraw_request->amount) }}

            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-3 col-from-label" for="channel">{{translate('Df Channel')}}</label>
            <div class="col-sm-9">
                <select id="demo-ease" class="from-control aiz-selectpicker" name="channel_id" required>
                    <option value="0">默认渠道</option>
                    @foreach ($channel as $c)
                        <option value="{{ $c->id }}" @if(false) selected @endif>{{ $c->heading }}</option>
                    @endforeach
                </select>
            </div>
        </div>

        <div id="txn_div" class="form-group row" style="display: none;">
            <label class="col-sm-3 col-from-label" for="txn_code">{{translate('Bank Transaction ID')}}</label>
            <div class="col-sm-9">

                <input type="text" name="txn_code" id="txn_code" class="form-control"
                       value="@if ($seller_withdraw_request->status && $seller_withdraw_request->payment->payment_method === 'bank_payment') {{$seller_withdraw_request->payment->txn_code}} @endif">

            </div>
        </div>

        <input type="hidden" id="withdraw-status" name="status" value="1">
    </div>
    <div class="modal-footer">
        @if($seller_withdraw_request->status == 0)
            <button type="button" class="btn btn-danger" onclick="reject_withdraw()">{{translate('Reject')}}</button>
        @endif
        @if($seller_withdraw_request->status == 0 && ($seller->cash_on_delivery_status || $seller->bank_payment_status))
            <button type="submit" class="btn btn-primary">{{translate('Pay')}}</button>
        @endif
        <button type="button" class="btn btn-light" data-dismiss="modal">{{translate('Cancel')}}</button>
    </div>
</form>

<script>

    $(document).ready(function () {
        @if ($seller_withdraw_request->status && $seller_withdraw_request->payment->payment_method === 'bank_payment')
        $("#txn_div").show()
        @endif


        AIZ.plugins.bootstrapSelect('refresh');

    });


    function reject_withdraw() {
        $('#withdraw-status').val(-1)
        $('#withdraw-requeest-form').submit();
    }
</script>
